package servidorActualizaciones.GUI;

import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;

public class Ventana extends JFrame implements ActionListener
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @param args
	 */
	JLabel tit;
	JLabel esp;
	JLabel con;
	int num;
	
	public Ventana()
	{
		tit = new JLabel("     SERVIDOR ACTUALIZACIONES");
		esp = new JLabel("Esperando clientes...");
		num = 0;
		con = new JLabel("Conexiones aceptadas: " + num);

		
		this.setLayout(new GridLayout(3, 1));
		this.add(tit);
		this.add(esp);
		this.add(con);
		
		this.pack();
		this.setLocationRelativeTo(null);
		this.setResizable(false);
		this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	}
	
	public void conexion()
	{
		num++;
		con.setText("Conexiones aceptadas: " + num);
		pack();
	}
	
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub
		Ventana v = new Ventana();
		v.setVisible(true);
	}
	
	@Override
	public void actionPerformed(ActionEvent e)
	{
		// TODO Auto-generated method stub
		if(e.getActionCommand() == "SALIR")
		{
			dispose();
		}
	}

}
